package cn.liyicun.cp.cpweb.mapper;

import cn.liyicun.cp.cpweb.entity.UserLoginLog;
import cn.liyicun.cp.cpweb.entity.UserLoginLogExample;
import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface UserLoginLogMapper extends Serializable {
    @SelectProvider(type=UserLoginLogSqlProvider.class, method="countByExample")
    long countByExample(UserLoginLogExample example);

    @DeleteProvider(type=UserLoginLogSqlProvider.class, method="deleteByExample")
    int deleteByExample(UserLoginLogExample example);

    @Delete({
        "delete from user_login_log",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into user_login_log (uid, create_time, ",
        "create_ip)",
        "values (#{uid,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{createIp,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(UserLoginLog record);

    @InsertProvider(type=UserLoginLogSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(UserLoginLog record);

    @SelectProvider(type=UserLoginLogSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_ip", property="createIp", jdbcType=JdbcType.VARCHAR)
    })
    List<UserLoginLog> selectByExampleWithRowbounds(UserLoginLogExample example, RowBounds rowBounds);

    @SelectProvider(type=UserLoginLogSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_ip", property="createIp", jdbcType=JdbcType.VARCHAR)
    })
    List<UserLoginLog> selectByExample(UserLoginLogExample example);

    @Select({
        "select",
        "id, uid, create_time, create_ip",
        "from user_login_log",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_ip", property="createIp", jdbcType=JdbcType.VARCHAR)
    })
    UserLoginLog selectByPrimaryKey(Long id);

    @UpdateProvider(type=UserLoginLogSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserLoginLog record, @Param("example") UserLoginLogExample example);

    @UpdateProvider(type=UserLoginLogSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserLoginLog record, @Param("example") UserLoginLogExample example);

    @UpdateProvider(type=UserLoginLogSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(UserLoginLog record);

    @Update({
        "update user_login_log",
        "set uid = #{uid,jdbcType=BIGINT},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "create_ip = #{createIp,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(UserLoginLog record);
}